﻿@model workflowMVC.Models.ContestModel

@{
    ViewBag.Title = "Create";
}

<h2 style="text-align:center">Tạo cuộc thi mới</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/timepicker.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <table class="ui-widget-content ui-corner-all" style="margin:auto;padding:5px">  
        <tr>
            <td>
                @Html.LabelFor(model => model.Title)
            </td>
            <td>
                @Html.TextBoxFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        
      
        <tr>
            <td>
                @Html.LabelFor(model => model.Description)
            </td>
            <td>
                @Html.TextAreaFor(model => model.Description)
            </td>
        </tr>
        <tr>
            <td>
                @Html.LabelFor(model => model.ExpDate)
            </td>
            <td>
                @Html.TextBoxFor(model => model.ExpDate, new { @class="dtp"})
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                @Html.ValidationMessageFor(model => model.ExpDate)
            </td>
        </tr>
        <tr id="fields">
                <td style="vertical-align:text-top">@Html.LabelFor(model => model.field)</td>
                <td>
                    <table class="ui-widget-content ui-corner-all" style="width:100%;">
                        @{var i = 0;
                          foreach (KeyValuePair<string, bool> f in Model.field)
                          {
                              
                              
                                  <tr>                            
                                    <td width="50%">
                                        <input type="hidden" name="@String.Format("field[{0}].Key", i)" value="@f.Key" />
                                        @Html.CheckBox(String.Format("field[{0}].Value", i), f.Value)
                                        <label for="@f.Key">@f.Key</label>
                                    </td>
                               </tr>

                              
                              i++;
                          }
                        }
                    </table>
                </td>
                
            </tr>
            <tr>
            <td></td>
            <td>
                @Html.ValidationMessage("field")
            </td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="Tạo mới" /></td>
        </tr>
        
    </table>
}
<script type="text/javascript">
    $(function () {
        $('.dtp').datetimepicker(
        {
            changeMonth: true,
            changeYear: true
        });
        $('.dtp').val("");
    });
                </script>
